home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d18 / turbotut.arc / CONSTANT.PAS < prev    next >
Pascal/Delphi Source File  |  1989-06-30  |  873b  |  29 lines

  1. PROGRAM example_of_constants;
  2.  
  3. CONST  max_size = 12; (* Pascal assumes this is a BYTE type, but it
  4.                          can be used as an integer also *)
  5.        index_start   : INTEGER = 49; (* This is a typed constant *)
  6.        check_it_out  : BOOLEAN = true; (* Another typed constant *)
  7.  
  8. TYPE bigarray  = ARRAY[1..max_size] OF INTEGER;
  9.      chararray = ARRAY[1..max_size] OF CHAR;
  10.  
  11. VAR  airplane   : bigarray;
  12.      seaplane   : bigarray;
  13.      helicopter : bigarray;
  14.      cows       : chararray;
  15.      horses     : chararray;
  16.      index      : INTEGER;
  17.  
  18. BEGIN  (* main program *)
  19.   FOR index := 1 TO max_size DO
  20.   BEGIN
  21.     airplane[index] := index*2;
  22.     seaplane[index] := index*3 + 7;
  23.     helicopter[max_size - index + 1] := index + airplane[index];
  24.     horses[index] := 'X';
  25.     cows[index] := 'R';
  26.   END;
  27. END.  (* of main program *)
  28.  
  29.